import 'package:flutter/material.dart';
import "package:myapp/widget/keepAliveWrapper.dart";
import "./type.dart";
import "./widget/HorizontalScrollCardWrap.dart";
import "./widget/DynamicItemWidget.dart";
import "./DynamicVisitScrollList.dart"; //最常访问

// 动态_视频页
class DynamicSubscribe extends StatelessWidget {
  final List<DynamicVisitItem> dynamicVisitList = [
    DynamicVisitItem(
      avatar: './images/1.jpg',
      upName: '波士顿圆脸',
      checked: false,
    ),
    DynamicVisitItem(
      avatar: './images/2.jpg',
      upName: '噩梦D',
      checked: false,
    ),
    DynamicVisitItem(
      avatar: './images/3.jpg',
      upName: 'NBzhuo大',
      checked: false,
    ),
    DynamicVisitItem(
      avatar: './images/1.jpg',
      upName: '艾露露Allurus',
      checked: false,
    ),
    DynamicVisitItem(
      avatar: './images/2.jpg',
      upName: '央视农业',
      checked: false,
    ),
    DynamicVisitItem(
      avatar: './images/3.jpg',
      upName: '刘老师说电影',
      checked: false,
    ),
    DynamicVisitItem(
      avatar: './images/1.jpg',
      upName: '物华弥新',
      checked: false,
    ),
    DynamicVisitItem(
      avatar: './images/2.jpg',
      upName: '插画家斋藤直葵',
      checked: false,
    ),
    DynamicVisitItem(
      avatar: './images/3.jpg',
      upName: '哔哩哔哩会员购',
      checked: false,
    ),
    DynamicVisitItem(
      avatar: './images/1.jpg',
      upName: '开心嘴炮',
      checked: false,
    ),
    DynamicVisitItem(
      avatar: './images/2.jpg',
      upName: 'STN工作室',
      checked: false,
    ),
    DynamicVisitItem(
      avatar: './images/3.jpg',
      upName: '小满zs',
      checked: false,
    ),
  ];

  // 正在直播
  final List<DynamicLivingItem> dynamicLivingList = [
    DynamicLivingItem(
      avatar: './images/1.jpg',
      upName: '波士顿圆脸',
    ),
    DynamicLivingItem(
      avatar: './images/2.jpg',
      upName: '波士顿圆脸',
    ),
    DynamicLivingItem(
      avatar: './images/3.jpg',
      upName: '波士顿圆脸',
    ),
    DynamicLivingItem(
      avatar: './images/1.jpg',
      upName: '波士顿圆脸',
    ),
    DynamicLivingItem(
      avatar: './images/2.jpg',
      upName: '波士顿圆脸',
    )
  ];

  final List<DynamicItem> dynamicList = [
    DynamicItem(
      dynamicUPInfo: DynamicUPInfo(
        name: "碧蓝航线",
        avatar: "./images/1.jpg",
        dynamicUPInfoAuthentication: DynamicUPInfoAuthentication(
          type: "institution",
          name: "碧蓝航线游戏官方账号",
        ),
        dynamicUPInfoFansCardInfo: DynamicUPInfoFansCardInfo(
          imageUrl: "./images/2.jpg",
          index: '000114',
          color: 0xff409eff,
        ),
      ),
      time: '16小时前',
      dynamicType: 'article', //文章
      shareCount: 0,
      commentCount: 92,
      likeCount: 846,
      isLike: true,
      dynamicArticleItem: DynamicArticleItem(
        title: "「共鸣的PASSION」即将开启！4月25日10:00刚去改建",
        content:
            "各位亲爱的指挥官：司令部将于4月25日10:00~16:00对以下港区进行为期6小时的改造建设（如有变动将会另行发布通知）。改建期间将暂时无法进入港区，还请各位指挥官提前做好下线准备，给各位带来的不便敬请谅解。",
        coverUrl: "./images/3.jpg",
      ),
      hotComment: DynamicCommentItem(
        upName: "井号5467",
        content: "祝大家三期μ船活动顺利毕业！祝大家三期μ船活动顺利毕业！祝大家三期μ船活动顺利毕业！",
      ),
      dynamicRelevant: DynamicRelevant(
        type: 'game',
        dynamicRelevantGame: DynamicRelevantGame(
          coverUrl: "./images/tab_1.jpg",
          title: '碧蓝航线',
          type: '养成',
          subTitle: '指挥官，欢迎回港',
        ),
      ),
    ),
    DynamicItem(
      dynamicUPInfo: DynamicUPInfo(
        name: "阿戈魔AG",
        avatar: "./images/1.jpg",
      ),
      time: '6分钟前',
      dynamicType: 'imageText',
      content: '摸个头像稿。发现ps里的木刻好用，再配上通道+渐变映射，事半功倍',
      shareCount: 0,
      commentCount: 92,
      likeCount: 846,
      isLike: true,
      dynamicImageTextItem: DynamicImageTextItem(
        dynamicImageListType: 'row',
        imageList: [
          "./images/1.jpg",
          "./images/2.jpg",
          "./images/3.jpg",
          "./images/1.jpg",
          "./images/2.jpg",
          "./images/3.jpg",
          "./images/1.jpg",
          "./images/2.jpg",
          "./images/3.jpg",
        ],
      ),
    ),
    DynamicItem(
      dynamicUPInfo: DynamicUPInfo(
        name: "噩梦D",
        avatar: "./images/1.jpg",
      ),
      time: '1个小时前',
      dynamicType: 'video',
      dynamicVideoItem: DynamicVideoItem(
        coverUrl: "./images/3.jpg",
        duration: "08:29",
        viewCount: "1.4万",
        danmuCount: "101",
        title: "这就是近几年来最优秀的合家欢喜剧动画！？《间谍过家家带好:白》观影指南",
        videoType: 'contribute',
      ),
      content: '这就是近几年来最优秀的合家欢喜剧动画！？《间谍过家家带好:白》观影指南',
      shareCount: 0,
      commentCount: 92,
      likeCount: 846,
      isLike: false,
    ),
    DynamicItem(
      dynamicUPInfo: DynamicUPInfo(
        name: "主厨农国栋",
        avatar: './images/1.jpg',
      ),
      time: '1个小时前',
      dynamicTopic: DynamicTopic(name: '春日出游美食'),
      dynamicLabelList: [
        DynamicLabel(name: '美食'),
        DynamicLabel(name: '美味'),
        DynamicLabel(name: '探店'),
      ],
      dynamicType: 'video',
      dynamicVideoItem: DynamicVideoItem(
        coverUrl: './images/3.jpg',
        duration: "08:29",
        viewCount: '1.4万',
        danmuCount: '101',
        title: "青岛美食探店Ⅱ————遇到添加海鲜？希望大家心里有杆秤，不要被带节奏",
        videoType: 'contribute',
      ),
      shareCount: 0,
      commentCount: 92,
      likeCount: 846,
      isLike: false,
    ),
    DynamicItem(
      dynamicUPInfo: DynamicUPInfo(
        name: '雨是灰色的',
        avatar: "./images/tab_1.jpg",
      ),
      time: '5分钟前',
      dynamicType: 'video',
      dynamicVideoItem: DynamicVideoItem(
        coverUrl: "./images/1.jpg",
        duration: "35:33",
        viewCount: "93",
        danmuCount: "17",
        title: "【直播回放】早期帕鲁被手游包围 2024xxxxxxxxxxxx",
        videoType: 'playback',
      ),
      shareCount: 0,
      commentCount: 0,
      likeCount: 8,
      isLike: false,
    ),
    DynamicItem(
      dynamicUPInfo: DynamicUPInfo(
        name: '-AKOvO-',
        avatar: "./images/tab_2.jpg",
      ),
      time: '36分钟前',
      content: '转发动态',
      dynamicType: 'share',
      dyanmicShareItem: DynamicShareItem(
        dynamicType: 'imageText',
        dynamicUPInfo: DynamicUPInfo(
          name: 'Sheya',
          avatar: "./images/tab_2.jpg",
          isSubscribe: true,
        ),
        dynamicImageTextItem: DynamicImageTextItem(
          imageList: ["./images/2.jpg"],
          dynamicImageListType: "card",
        ),
      ),
      shareCount: 1,
      commentCount: 0,
      likeCount: 40,
      isLike: false,
    ),
    DynamicItem(
      dynamicUPInfo: DynamicUPInfo(
        name: '茶木HZ',
        avatar: "./images/tab_3.jpg",
        isVIP: true,
      ),
      time: '4小时前',
      content: '转发动态',
      dynamicType: 'share',
      dyanmicShareItem: DynamicShareItem(
        content: '笼中的鸟儿，与星辰与花海的梦境中歌唱',
        dynamicType: 'imageText',
        dynamicUPInfo: DynamicUPInfo(
          name: '_高级员工鳐',
          avatar: "./images/tab_2.jpg",
          isSubscribe: false,
        ),
        dynamicImageTextItem: DynamicImageTextItem(
          imageList: ["./images/1.jpg"],
          dynamicImageListType: "card",
        ),
        dynamicTopic: DynamicTopic(name: '崩坏·星穹铁道'),
      ),
      shareCount: 1,
      commentCount: 0,
      likeCount: 40,
      isLike: false,
    ),
    DynamicItem(
      dynamicUPInfo: DynamicUPInfo(
        name: "艾露露Ailurus",
        avatar: "./images/tab_2.jpg",
        isVIP: true,
        dynamicUPInfoAuthentication: DynamicUPInfoAuthentication(
          type: "UP",
          name: 'bulibili直播高能主播',
        ),
        dynamicUPInfoFansCardInfo: DynamicUPInfoFansCardInfo(
          imageUrl: "./images/3.jpg",
          index: '000562',
          color: 0xff412395,
        ),
      ),
      dynamicVideoItem: DynamicVideoItem(
        coverUrl: "./images/3.jpg",
        duration: "00:31",
        viewCount: '2.2万',
        danmuCount: "6",
        videoType: "dynamic",
      ),
      time: "昨天 03:26",
      dynamicType: "video",
      shareCount: 2,
      commentCount: 65,
      likeCount: 1010,
      isLike: true,
    ),
    DynamicItem(
      dynamicUPInfo: DynamicUPInfo(
        name: "艾露露Ailurus",
        avatar: "./images/tab_2.jpg",
        isVIP: true,
        dynamicUPInfoAuthentication: DynamicUPInfoAuthentication(
          type: "UP",
          name: 'bulibili直播高能主播',
        ),
        dynamicUPInfoFansCardInfo: DynamicUPInfoFansCardInfo(
          imageUrl: "./images/3.jpg",
          index: '000562',
          color: 0xff412395,
        ),
      ),
      dyanmicShareItem: DynamicShareItem(
        dynamicType: "video",
        dynamicUPInfo: DynamicUPInfo(
          name: "艾露露Ailurus",
          avatar: "./images/tab_2.jpg",
          isVIP: true,
          dynamicUPInfoAuthentication: DynamicUPInfoAuthentication(
            type: "UP",
            name: 'bulibili直播高能主播',
          ),
          dynamicUPInfoFansCardInfo: DynamicUPInfoFansCardInfo(
            imageUrl: "./images/3.jpg",
            index: '000562',
            color: 0xff412395,
          ),
        ),
        dynamicVideoItem: DynamicVideoItem(
          coverUrl: "./images/3.jpg",
          duration: "00:31",
          viewCount: '2.2万',
          danmuCount: "6",
          videoType: "dynamic",
        ),
      ),
      time: "昨天 03:26",
      dynamicType: "share",
      shareCount: 2,
      commentCount: 65,
      likeCount: 1010,
      isLike: true,
    ),
    DynamicItem(
      dynamicUPInfo: DynamicUPInfo(
        name: '香格里拉边境',
        avatar: "./images/tab_2.jpg",
      ),
      dynamicVideoItem: DynamicVideoItem(
        title: "香格里拉边境：第24话 稀有道具的分量比生命更重",
        coverUrl: './images/3.jpg',
        duration: "23:25",
        viewCount: "203.5万",
        danmuCount: "2840",
        videoType: "animate",
      ),
      hotComment: DynamicCommentItem(
        upName: "彼岸之扉连理bili",
        content: "我因为偷懒，成功理解到了阳乐的心情，只要我在快那么30秒，我两场深渊就打完了，历练值也就弄到手了。",
      ),
      time: '4月28日',
      dynamicType: 'video',
      shareCount: 10,
      commentCount: 357,
      likeCount: 14000,
      isLike: false,
    ),
    DynamicItem(
      dynamicUPInfo: DynamicUPInfo(
        name: '哔哩哔哩会员购',
        avatar: "./images/tab_3.jpg",
        isLiving: true,
        dynamicUPInfoAuthentication: DynamicUPInfoAuthentication(
          type: 'institution',
          name: '哔哩哔哩会员购 官方账号',
        ),
      ),
      time: "23分钟前",
      dynamicType: "imageText",
      dynamicImageTextItem: DynamicImageTextItem(
        imageList: [
          "./images/tab_1.jpg",
          "./images/tab_2.jpg",
          "./images/tab_3.jpg",
          "./images/tab_4.jpg",
          "./images/tab_5.jpg",
          "./images/tab_1.jpg",
        ],
        dynamicImageListType: "card",
      ),
      content: "【新品速递】\n最适合花の塔的一集！\n千束和泷奈携手出门啦，私服和浴衣都可爱的过分啊...\n\n",
      dynamicUPRecommendGoodsList: [
        DynamicUPRecommendGoods(
          coverUrl: "./images/tab_1.jpg",
          title: "猫噜噜 Vsigner 洛天依 雪舞天音·新疆毛绒系列",
          subTitle: '随书附赠：典藏画卡×2+精美套装×1+xxx',
          price: "59",
        ),
        DynamicUPRecommendGoods(
          coverUrl: "./images/tab_2.jpg",
          title: "猫噜噜 Vsigner 洛天依 雪舞天音·新疆毛绒系列",
          subTitle: '随书附赠：典藏画卡×2+精美套装×1+xxx',
          price: "59.3",
        ),
        DynamicUPRecommendGoods(
          coverUrl: "./images/tab_3.jpg",
          title: "猫噜噜 Vsigner 洛天依 雪舞天音·新疆毛绒系列",
          subTitle: '随书附赠：典藏画卡×2+精美套装×1+xxx',
          price: "59.3",
        ),
      ],
      shareCount: 0,
      commentCount: 0,
      likeCount: 211,
      isLike: false,
    )
  ];

  DynamicSubscribe({super.key});
  @override
  Widget build(BuildContext context) {
    return MediaQuery.removePadding(
      context: context,
      removeTop: true,
      child: ListView(
        children: [
          KeepAliveWrapper(
            child: HorizontalScrollCardWrap(
              leading: const Text(
                '最常访问',
                style: TextStyle(
                  fontWeight: FontWeight.bold,
                  fontSize: 14,
                ),
              ),
              trailing: Row(
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  Text(
                    '${dynamicLivingList.isNotEmpty ? '${dynamicLivingList.length}人直播中 · ' : ''}更多',
                    style: const TextStyle(
                      color: Colors.black54,
                      fontSize: 12,
                    ),
                  ),
                  const Icon(
                    Icons.keyboard_arrow_right,
                    color: Colors.black54,
                    size: 18,
                  )
                ],
              ),
              body: Column(
                children: [
                  DynamicVisitScrollListWidget(
                    dynamicLivingItemList: dynamicLivingList,
                    dynamicVisitItemList: dynamicVisitList,
                  ),
                ],
              ),
            ),
          ),
          const SizedBox(height: 10),
          ...dynamicList.map((e) {
            return KeepAliveWrapper(child: DynamicItemWidget(dynamicItem: e));
          }).toList(),
          const SizedBox(height: 80)
        ],
      ),
    );
  }
}
